<!DOCTYPE html>
<html lang="zh" dir="ltr">
<head><script src="/livereload.js?mindelay=10&amp;v=2&amp;port=1313&amp;path=livereload" data-no-instant defer></script>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="了解神马中转API的使用方法，掌握如何配置和调用中转API服务，轻松解决接口调用难题。">
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#343a40">
<meta name="color-scheme" content="light dark"><meta property="og:url" content="http://localhost:1313/docs/openai/ptdhls/">
  <meta property="og:site_name" content="神马中转API_低价稳定中转API推荐">
  <meta property="og:title" content="普通文本对话（流式输出）">
  <meta property="og:description" content="了解神马中转API的使用方法，掌握如何配置和调用中转API服务，轻松解决接口调用难题。">
  <meta property="og:locale" content="zh">
  <meta property="og:type" content="article">
    <meta property="article:section" content="docs">
    <meta property="article:modified_time" content="2025-09-21T00:12:32+08:00">
    <meta property="article:tag" content="API">
    <meta property="article:tag" content="中转API">
    <meta property="article:tag" content="服务使用">
<title>普通文本对话（流式输出） | 神马中转API_低价稳定中转API推荐</title>
<link rel="icon" href="/favicon.png" >
<link rel="manifest" href="/manifest.json">
<link rel="canonical" href="http://localhost:1313/docs/openai/ptdhls/">
<link rel="stylesheet" href="/book.min.ce1689397c669bcad456856a83f58cfccb0f8b23e5dd2bbff3755c795c7c8e70.css" integrity="sha256-zhaJOXxmm8rUVoVqg/WM/MsPiyPl3Su/83VceVx8jnA=" crossorigin="anonymous">
  <script defer src="/fuse.min.js"></script>
  <script defer src="/zh.search.min.e0e482070ec6d6d785985b436113219157ff4e98f68389abe3e06a9d7752fafd.js" integrity="sha256-4OSCBw7G1teFmFtDYRMhkVf/Tpj2g4mr4&#43;BqnXdS&#43;v0=" crossorigin="anonymous"></script>

  <script defer src="/sw.min.6f6f90fcb8eb1c49ec389838e6b801d0de19430b8e516902f8d75c3c8bd98739.js" integrity="sha256-b2&#43;Q/LjrHEnsOJg45rgB0N4ZQwuOUWkC&#43;NdcPIvZhzk=" crossorigin="anonymous"></script>
<!--
Made with Book Theme
https://github.com/alex-shpak/hugo-book
-->
  
</head>
<body dir="ltr" class="book-kind-page book-type-docs book-layout-">
  <input type="checkbox" class="hidden toggle" id="menu-control" />
  <input type="checkbox" class="hidden toggle" id="toc-control" />
  <main class="container flex">
    
<aside class="book-menu">
  <div class="book-menu-content">
    
  <nav>
<h2 class="book-brand">
  <a class="flex align-center" href="/"><span>神马中转API_低价稳定中转API推荐</span>
  </a>
</h2>


<div class="book-search hidden">
  <input type="text" id="book-search-input" placeholder="搜索" aria-label="搜索" maxlength="64" data-hotkeys="s/" />
  <div class="book-search-spinner hidden"></div>
  <ul id="book-search-results"></ul>
</div>
<script>document.querySelector(".book-search").classList.remove("hidden")</script>















  
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/introduction/" class="">神马中转API一站式AI大模型API中转站 · 低价好用稳定的中转API服务</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-a1a75651f33f50151b1f3e0e2f525ee1" class="toggle"  />
    <label for="section-a1a75651f33f50151b1f3e0e2f525ee1" class="flex">
      <a role="button" class="flex-auto ">基础知识</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/aidocs/base/" class="">基本概念-令牌（Token）</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/aidocs/key/" class="">添加令牌：您的AI通行证指南</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/aidocs/api/" class="">基本概念-API地址（BaseURL）</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/aidocs/group/" class="">基本概念-令牌渠道分组</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/aidocs/pay1/" class="">基本概念-按量付费</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/aidocs/pay2/" class="">基本概念-按次付费</a>
  

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-cd3c7c429af15477d4ff05ea111934a3" class="toggle"  />
    <label for="section-cd3c7c429af15477d4ff05ea111934a3" class="flex">
      <a role="button" class="flex-auto ">站内基础教程</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/wallet/" class="">基础教程-钱包 · 页面</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/model/" class="">基础教程-支持模型 · 页面</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/chat/" class="">基础教程-聊天 · 页面</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/dev/" class="">基础教程-开发者 · 快速接入</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/sdk/" class="">高级功能-官方SDK支持</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/notice/" class="">高级功能-通知设置 · 额度预警通知</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/keysafety/" class="">高级功能-API KEY 安全配置</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/ailearn/errorcode/" class="">常见报错码</a>
  

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-a2f7d319ec4c5bbb43978c97667e6cea" class="toggle" checked />
    <label for="section-a2f7d319ec4c5bbb43978c97667e6cea" class="flex">
      <a role="button" class="flex-auto ">Openai请求格式（通用）</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/syfw/" class="">适用范围：♥ 所有模型</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/ptdhfl/" class="">普通文本对话（非流）</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/ptdhls/" class="active">普通文本对话（流式输出）</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/gdgshscjson/" class="">固定格式化输出Json</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/embedding/" class="">embedding代码例子</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/wltpjx/" class="">网络图片解析</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/bdtpjx/" class="">本地图片解析</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/functioncall/" class="">函数调用FunctionCall</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/whisper/" class="">whisper使用示例</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/gpttts/" class="">gpt-tts</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/gptwst/" class="">gpt文生图</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/openai/gpttst/" class="">gpt图生图</a>
  

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-0621f15f4cf04829ac2eddaaa730205e" class="toggle"  />
    <label for="section-0621f15f4cf04829ac2eddaaa730205e" class="flex">
      <a role="button" class="flex-auto ">模型接入教程</a>
    </label>
  

          
  <ul>
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <span>常见AI程序配置教程</span>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-5e705709838a94aa211a15f9c6e02e24" class="toggle"  />
    <label for="section-5e705709838a94aa211a15f9c6e02e24" class="flex">
      <a role="button" class="flex-auto ">编程工具类</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/devtools/claudecode/" class="">Claude code 配置方式</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/devtools/pythonopenai/" class="">python openai官方库（使用AutoGPT，langchain等）</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/devtools/codegpt/" class="">VSCode 插件 Code GPT 使用指南</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/devtools/easycode/" class="">JetBrains插件 Easycode ​</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/devtools/langchain/" class="">LangChain​</a>
  

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-1d8817d18f5c961cd85158eff2d9c95e" class="toggle"  />
    <label for="section-1d8817d18f5c961cd85158eff2d9c95e" class="flex">
      <a role="button" class="flex-auto ">对话客户端类</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/cherrystudio/" class="">Cherry Studio</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/chatgptwebmidjourneyproxy/" class="">Chatgpt-web-midjourney-proxy</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/lobechat/" class="">Lobe-Chat</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/utools-chatgpt/" class="">utools-ChatGPT</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/sidebar/" class="">浏览器插件 ChatGPT Sidebar</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/chatbox/" class="">ChatBox(推荐使用)</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/chatnextweb/" class="">Chat Next Web</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/GoAmz/" class="">GoAmz</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/SparkAI/" class="">SparkAI</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/chat/nineai/" class="">NineAI(99AI) </a>
  

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-b333ba0fec99449c08fe8af0c1f5a49b" class="toggle"  />
    <label for="section-b333ba0fec99449c08fe8af0c1f5a49b" class="flex">
      <a role="button" class="flex-auto ">工具类</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/tools/raycast/" class="">Raycast 插件 ChatGPT 使用指南（推荐使用）</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/tools/dify/" class="">Dify</a>
  

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <input type="checkbox" id="section-5852b31e2d938d5dbe93ddd86df36c0f" class="toggle"  />
    <label for="section-5852b31e2d938d5dbe93ddd86df36c0f" class="flex">
      <a role="button" class="flex-auto ">官方SDK类</a>
    </label>
  

          
  <ul>
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/sdk/openaisdk/" class="">OpenAI官方SDK</a>
  

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/otherai/sdk/geminisdk/" class="">Gemini SDK 配置</a>
  

        </li>
      
    
  </ul>

        </li>
      
    
  </ul>

        </li>
      
    
      
        <li>
          
  
  

  
    <a href="/docs/errorcode/" class="">常见错误以及解决办法</a>
  

        </li>
      
    
  </ul>










  
<ul>
  
  <li>
    
    <a href="https://whatai.cc"  target="_blank" rel="noopener">
        AI导航
      </a>
  </li>
  
  <li>
    
    <a href="https://api.whatai.cc"  target="_blank" rel="noopener">
        中转API官网
      </a>
  </li>
  
</ul>






</nav>




  <script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script>



  </div>
</aside>
 

    <div class="book-page">
      <header class="book-header">
        
  <div class="flex align-center justify-between">
  <label for="menu-control">
    <img src="/svg/menu.svg" class="book-icon" alt="Menu" />
  </label>

  <h3>普通文本对话（流式输出）</h3>

  <label for="toc-control">
    
    <img src="/svg/toc.svg" class="book-icon" alt="Table of Contents" />
    
  </label>
</div>


  
  <aside class="hidden clearfix">
    
  
<nav id="TableOfContents">
  <ul>
    <li><a href="#普通文本对话流式输出">普通文本对话（流式输出）</a>
      <ul>
        <li>
          <ul>
            <li><a href="#基础信息"><strong>基础信息</strong></a></li>
            <li><a href="#请求参数"><strong>请求参数</strong></a></li>
            <li><a href="#python-请求示例"><strong>Python 请求示例</strong></a></li>
            <li><a href="#注意事项"><strong>注意事项</strong></a></li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>
</nav>



  </aside>
  
 
      </header>

      
      
  <article class="markdown book-article"><h1 id="普通文本对话流式输出">
  普通文本对话（流式输出）
  
  <a class="anchor" href="#%e6%99%ae%e9%80%9a%e6%96%87%e6%9c%ac%e5%af%b9%e8%af%9d%e6%b5%81%e5%bc%8f%e8%be%93%e5%87%ba">#</a>
  
</h1>
<h3 id="基础信息">
  <strong>基础信息</strong>
  
  <a class="anchor" href="#%e5%9f%ba%e7%a1%80%e4%bf%a1%e6%81%af">#</a>
  
</h3>
<ul>
<li>
<p>接口地址: <a href="https://api.whatai.cc">https://api.whatai.cc</a></p>
</li>
<li>
<p>认证方式: Bearer Token (API Key)</p>
</li>
</ul>
<h3 id="请求参数">
  <strong>请求参数</strong>
  
  <a class="anchor" href="#%e8%af%b7%e6%b1%82%e5%8f%82%e6%95%b0">#</a>
  
</h3>
<table>
  <thead>
      <tr>
          <th><strong>参数</strong></th>
          <th><strong>类型</strong></th>
          <th><strong>说明</strong></th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>model</td>
          <td>string</td>
          <td>模型名称(如gpt-4o-mini)</td>
      </tr>
      <tr>
          <td>stream</td>
          <td>boolean</td>
          <td>是否开启流式输出</td>
      </tr>
      <tr>
          <td>messages</td>
          <td>array</td>
          <td>对话消息列表</td>
      </tr>
  </tbody>
</table>
<h3 id="python-请求示例">
  <strong>Python 请求示例</strong>
  
  <a class="anchor" href="#python-%e8%af%b7%e6%b1%82%e7%a4%ba%e4%be%8b">#</a>
  
</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">import</span> json
</span></span><span style="display:flex;"><span><span style="color:#f92672">import</span> requests
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 配置请求参数</span>
</span></span><span style="display:flex;"><span>url <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;https://api.whatai.cc/v1/chat/completions&#34;</span>
</span></span><span style="display:flex;"><span>headers <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;Authorization&#34;</span>: <span style="color:#e6db74">&#34;Bearer sk-******&#34;</span>,  <span style="color:#75715e"># 替换为你的API Key</span>
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;Content-Type&#34;</span>: <span style="color:#e6db74">&#34;application/json&#34;</span>
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>payload <span style="color:#f92672">=</span> {
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;model&#34;</span>: <span style="color:#e6db74">&#34;gpt-4o-mini&#34;</span>,
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;stream&#34;</span>: <span style="color:#66d9ef">True</span>,  <span style="color:#75715e"># 开启流式输出</span>
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;messages&#34;</span>: [
</span></span><span style="display:flex;"><span>        {<span style="color:#e6db74">&#34;role&#34;</span>: <span style="color:#e6db74">&#34;system&#34;</span>, <span style="color:#e6db74">&#34;content&#34;</span>: <span style="color:#e6db74">&#34;You are a helpful assistant.&#34;</span>},
</span></span><span style="display:flex;"><span>        {<span style="color:#e6db74">&#34;role&#34;</span>: <span style="color:#e6db74">&#34;user&#34;</span>, <span style="color:#e6db74">&#34;content&#34;</span>: <span style="color:#e6db74">&#34;周树人和鲁迅是兄弟吗？&#34;</span>},
</span></span><span style="display:flex;"><span>    ]
</span></span><span style="display:flex;"><span>}
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># 发送请求并处理流式响应</span>
</span></span><span style="display:flex;"><span>response <span style="color:#f92672">=</span> requests<span style="color:#f92672">.</span>post(url, headers<span style="color:#f92672">=</span>headers, json<span style="color:#f92672">=</span>payload, stream<span style="color:#f92672">=</span><span style="color:#66d9ef">True</span>)
</span></span><span style="display:flex;"><span>buffer <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">for</span> chunk <span style="color:#f92672">in</span> response<span style="color:#f92672">.</span>iter_content(chunk_size<span style="color:#f92672">=</span><span style="color:#66d9ef">None</span>):
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">if</span> chunk:
</span></span><span style="display:flex;"><span>        buffer <span style="color:#f92672">+=</span> chunk<span style="color:#f92672">.</span>decode(<span style="color:#e6db74">&#34;utf-8&#34;</span>)
</span></span><span style="display:flex;"><span>        <span style="color:#66d9ef">while</span> <span style="color:#e6db74">&#34;</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">&#34;</span> <span style="color:#f92672">in</span> buffer:
</span></span><span style="display:flex;"><span>            line, buffer <span style="color:#f92672">=</span> buffer<span style="color:#f92672">.</span>split(<span style="color:#e6db74">&#34;</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">&#34;</span>, <span style="color:#ae81ff">1</span>)
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">if</span> <span style="color:#f92672">not</span> line<span style="color:#f92672">.</span>strip():  <span style="color:#75715e"># 跳过空行</span>
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">continue</span>
</span></span><span style="display:flex;"><span>                
</span></span><span style="display:flex;"><span>            <span style="color:#66d9ef">if</span> line<span style="color:#f92672">.</span>startswith(<span style="color:#e6db74">&#34;data: &#34;</span>):
</span></span><span style="display:flex;"><span>                data_line <span style="color:#f92672">=</span> line[<span style="color:#ae81ff">6</span>:]<span style="color:#f92672">.</span>strip()  <span style="color:#75715e"># 去除&#34;data: &#34;前缀</span>
</span></span><span style="display:flex;"><span>                
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">if</span> data_line <span style="color:#f92672">==</span> <span style="color:#e6db74">&#34;[DONE]&#34;</span>:  <span style="color:#75715e"># 流式结束标记</span>
</span></span><span style="display:flex;"><span>                    <span style="color:#66d9ef">break</span>
</span></span><span style="display:flex;"><span>                    
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">try</span>:
</span></span><span style="display:flex;"><span>                    data <span style="color:#f92672">=</span> json<span style="color:#f92672">.</span>loads(data_line)
</span></span><span style="display:flex;"><span>                    <span style="color:#75715e"># 提取并打印响应内容</span>
</span></span><span style="display:flex;"><span>                    content <span style="color:#f92672">=</span> data[<span style="color:#e6db74">&#34;choices&#34;</span>][<span style="color:#ae81ff">0</span>][<span style="color:#e6db74">&#34;delta&#34;</span>]<span style="color:#f92672">.</span>get(<span style="color:#e6db74">&#34;content&#34;</span>, <span style="color:#e6db74">&#34;&#34;</span>)
</span></span><span style="display:flex;"><span>                    print(content, end<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;&#34;</span>, flush<span style="color:#f92672">=</span><span style="color:#66d9ef">True</span>)
</span></span><span style="display:flex;"><span>                <span style="color:#66d9ef">except</span> json<span style="color:#f92672">.</span>JSONDecodeError:
</span></span><span style="display:flex;"><span>                    <span style="color:#75715e"># 处理不完整JSON数据</span>
</span></span><span style="display:flex;"><span>                    buffer <span style="color:#f92672">=</span> line <span style="color:#f92672">+</span> <span style="color:#e6db74">&#34;</span><span style="color:#ae81ff">\n</span><span style="color:#e6db74">&#34;</span> <span style="color:#f92672">+</span> buffer
</span></span><span style="display:flex;"><span>                    <span style="color:#66d9ef">break</span>
</span></span></code></pre></div><h3 id="注意事项">
  <strong>注意事项</strong>
  
  <a class="anchor" href="#%e6%b3%a8%e6%84%8f%e4%ba%8b%e9%a1%b9">#</a>
  
</h3>
<ol>
<li>
<p>请妥善保管API Key</p>
</li>
<li>
<p>建议使用HTTPS协议</p>
</li>
<li>
<p>响应格式为JSON</p>
</li>
</ol>
</article>
 
      

      <footer class="book-footer">
        
  <div class="flex flex-wrap justify-between">





</div>





  
  
  
  <div class="flex flex-wrap justify-between">
    <span>
    
      <a href="/docs/openai/ptdhfl/" class="flex align-center book-icon">
        <img src="/svg/backward.svg" class="book-icon" alt="Previous" title="普通文本对话（非流）" />
        <span>普通文本对话（非流）</span>
      </a>
    
    </span>
    <span>
    
      <a href="/docs/openai/gdgshscjson/" class="flex align-center book-icon">
        <span>固定格式化输出Json</span>
        <img src="/svg/forward.svg" class="book-icon" alt="Next" title="固定格式化输出Json" />
      </a>
    
    </span>
  </div>
  




  <script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script>


 
        
      </footer>

      
  
  <div class="book-comments">

</div>
  
 
      <label for="menu-control" class="hidden book-menu-overlay"></label>
    </div>

    

<aside class="book-toc">
  <div class="book-toc-content">
    
  
<nav id="TableOfContents">
  <ul>
    <li><a href="#普通文本对话流式输出">普通文本对话（流式输出）</a>
      <ul>
        <li>
          <ul>
            <li><a href="#基础信息"><strong>基础信息</strong></a></li>
            <li><a href="#请求参数"><strong>请求参数</strong></a></li>
            <li><a href="#python-请求示例"><strong>Python 请求示例</strong></a></li>
            <li><a href="#注意事项"><strong>注意事项</strong></a></li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>
</nav>



  </div>
</aside>

 
  </main>

  
</body>
</html>
















